namespace Domotica.Windows.Input
{
    using System;
    using System.ComponentModel;
    using System.Windows.Input;
    using System.Windows.Markup;

    [ValueSerializer(typeof(SignGestureValueSerializer)), TypeConverter(typeof(SignGestureConverter))]
    public class SignGesture : InputGesture
    {
        private ModifierKeys _Modifiers;
        private Domotica.Windows.Input.SignAction _SignAction;

        public SignGesture()
        {
        }

        public SignGesture(Domotica.Windows.Input.SignAction signAction)
        {
            this._SignAction = signAction;
        }

        public SignGesture(Domotica.Windows.Input.SignAction signAction, ModifierKeys modifierKeys) : this(signAction)
        {
            this._Modifiers = modifierKeys;
        }

        public override bool Matches(object targetElement, InputEventArgs inputEventArgs)
        {
            if (inputEventArgs is SignEventArgs)
            {
                SignEventArgs sea = (SignEventArgs) inputEventArgs;
                Domotica.Windows.Input.SignAction signAction = sea.SignAction;
                if (signAction == Domotica.Windows.Input.SignAction.None)
                {
                    return false;
                }
                return ((this.SignAction == signAction) && (this.Modifiers == Keyboard.Modifiers));
            }
            return false;
        }

        public ModifierKeys Modifiers
        {
            get
            {
                return this._Modifiers;
            }
            set
            {
                this._Modifiers = value;
            }
        }

        public Domotica.Windows.Input.SignAction SignAction
        {
            get
            {
                return this._SignAction;
            }
            set
            {
                this._SignAction = value;
            }
        }
    }
}

